package org.jeecg.system.common.service.impl;

import org.jeecg.modules.system.util.ChangeLog;
import org.jeecg.system.common.entity.ChangeLogs;
import org.jeecg.system.common.mapper.ChangeLogsMapper;
import org.jeecg.system.common.service.IChangeLogsService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 公共修改日志表
 * @Author: jeecg-boot
 * @Date:   2020-06-15
 * @Version: V1.0
 */
@Service
public class ChangeLogsServiceImpl extends ServiceImpl<ChangeLogsMapper, ChangeLogs> implements IChangeLogsService {

    @Override
    public boolean saveChangeLogs(Class t, Object oldObj, Object newObj, String saveName, String updKey) {
        List<ChangeLogs> check = ChangeLog.check(t, oldObj, newObj, saveName);
        check.forEach(o->o.setUpdKey(updKey));
        boolean code = this.saveBatch(check);

        return code;
    }
}
